package org.fhm.zdte.common.standard;

import org.fhm.zdte.common.pojo.Address;
import org.fhm.zdte.common.pojo.Request;
import org.fhm.zdte.common.protocol.AbstractMessageStandard;

/**
 * The interface <b>ISendMessageManager</b>'s implementation is used to manage on during send the message.
 *
 * @author 谭波
 * @since 2023/11/28
 */
public interface ISendMessageManager {

    /**
     * Initialization of the cycle Send-Message-Manager.
     *
     * @param bean          The {@link Request} to which it is sent.
     * @param messageNumber Message number that is a 32-digit string of UUID.
     * @param target        The identification of the receiver side.
     */
    void initial(Request bean, String messageNumber, String target);

    /**
     * Cancel initialization of the cycle task and start send encapsulated Sub-Packet-Messages.
     *
     * @param messageNumber Message number that is a 32-digit string of UUID.
     * @param address       The source address of Packet-Message.
     */
    void cancelInitialTaskAndSend(String messageNumber, Address address);

    /**
     * Send encapsulated Sub-Packet-Messages again.
     *
     * @param message Packet-Message.
     * @param address The source address of Packet-Message.
     */
    void resendResponse(AbstractMessageStandard message, Address address);

    /**
     * Clear the disconnected client Packet-Message-Buffer.
     *
     * @param from The identification of the disconnected client side.
     */
    void clearMessageBuffer(String from);

}
